//
//  PFRootTBCell.m
//  PFDevelopKit
//
//  Created by 原鹏飞 on 2018/10/29.
//  Copyright © 2018 ypf. All rights reserved.
//

#import "PFRootTBCell.h"

@interface PFRootTBCell ()

@property (nonatomic, strong) UILabel *moduleNameLabel;

@end

@implementation PFRootTBCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}


- (void)setNameStr:(NSString *)nameStr {
    _nameStr = nameStr;
    self.textLabel.text = nameStr;
}


- (void)setupUI {
    
    NSLog(@"%zd组, %zd行", self.indexPath.section, self.indexPath.row);
    
    _moduleNameLabel = [UILabel pf_labelWithText:self.nameStr andTextColor:[UIColor redColor]];
    [self addSubview:_moduleNameLabel];
    [_moduleNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
        make.centerY.equalTo(self);
        make.height.mas_equalTo(20);
    }];
    
    _nextBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    [self addSubview:_nextBtn];
    [_nextBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.centerY.equalTo(self);
        make.height.mas_equalTo(20);
        make.width.mas_equalTo(50);
    }];
    _nextBtn.backgroundColor = UIColor.orangeColor;
}


- (void)setModel:(PFRootTBModel *)model {
    _model = model;
    self.moduleNameLabel.text = model.moduleName;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
